{include file="public/header"/}
</head>
<body>
<div class="layui-form">
    <div class="layui-fluid pd83" id="LAY-component-layer-list">
        <div class="layui-col-sm12">
            <div class="layui-card pcf30">
                <div class="layui-form-item">
                    <label class="layui-form-label">URL模式</label>
                    <div class="layui-input-block">
                    {volist name="seo_pseudo_list" id="vo"}
                    <input type="radio" name="seo_pseudo" lay-filter="seo_pseudo" value="{$key}" title="{$vo}" {if($config.seo_pseudo eq $key)}checked{/if}/>
                    {/volist}
                    </div>
                </div>
                <div class="layui-form-item {if(isset($config.seo_pseudo) && $config.seo_pseudo !=2)}none{/if}" id="dl_seo_rewrite_format">
                    <label class="layui-form-label">伪静态</label>
                    <div class="layui-input-block">
                      <input type="radio" name="seo_rewrite_format" value="1" title="目录名称" {if condition="!isset($config.seo_rewrite_format) OR $config.seo_rewrite_format eq 1"} checked{/if}>
                      <p class="info-text">（<a href="javascript:void(0);" onclick="view_exp('view_3_1');">查看例子</a><span id="view_3_1" class="none">：{$Request.domain}/about/</span>）</p>
                      <input type="radio" name="seo_rewrite_format" value="2" title="模型标识" {if condition="isset($config.seo_rewrite_format) AND $config.seo_rewrite_format eq 2"} checked{/if}>
                      <p class="info-text">（<a href="javascript:void(0);" onclick="view_exp('view_3_2');">查看例子</a><span id="view_3_2" class="none">：{$Request.domain}/single/about.html</span>）</p>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">栏目页SEO</label>
                    <div class="layui-input-block">
                      <input type="radio" name="seo_liststitle_format" value="1" title="栏目名称_网站名称" {if condition="isset($config.seo_liststitle_format) AND $config.seo_liststitle_format eq 1"} checked{/if}><br>
                      <input type="radio" name="seo_liststitle_format" value="2" title="栏目名称_第N页_网站名称" {if condition="!isset($config.seo_liststitle_format) OR $config.seo_liststitle_format eq 2"} checked{/if}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">内容页SEO</label>
                    <div class="layui-input-block">
                      <input type="radio" name="seo_viewtitle_format" value="1" title="内容标题" {if condition="isset($config.seo_viewtitle_format) AND $config.seo_viewtitle_format eq 1"} checked{/if}><br>
                      <input type="radio" name="seo_viewtitle_format" value="2" title="内容标题_网站名称" {if condition="!isset($config.seo_viewtitle_format) OR $config.seo_viewtitle_format eq 2"} checked{/if}><br>
                      <input type="radio" name="seo_viewtitle_format" value="3" title="内容标题_栏目名称_网站名称" {if condition="isset($config.seo_viewtitle_format) AND $config.seo_viewtitle_format eq 3"} checked{/if}>
                    </div>
                </div>
            </div>
        </div>
        <div class="pcfclear"></div>    
    </div>
    <div class="submit-info text-center">
        <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
    </div>
</div>
{include file="public/footer"/}
<script>
    layui.use(['layer', 'form', 'element'], function () {
        var $ = layui.$,
        element = layui.element,
        form = layui.form,
        layer = layui.layer;

        // 监听URL模式
        form.on('radio(seo_pseudo)', function(data){
            var obj = data.elem;
            var seo_pseudo = $(obj).val();
            if (2 == seo_pseudo) {
                $('#dl_seo_rewrite_format').show();
            } else {
                $('#dl_seo_rewrite_format').hide();
            } 
        });

        //监听提交
        form.on('submit(formSubmit)', function(data){
            layer.msg('正在处理请勿刷新页面', {icon: 16,shade: 0.01,time:3600000});
            $.ajax({
                type : 'post',
                url : '{:url("/adminseo/add")}',
                data : data.field,
                dataType : 'json',
                success : function(res){
                    layer.closeAll('loading');
                    if(res.status){
                        layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                            window.location.href = res.url;
                        });
                    }else{
                        layer.msg(res.msg, {icon: 2, time: 1000});
                    }
                },
                error: function(e){
                    layer.closeAll('loading');
                    layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                }
            });
        })

    });

    function view_exp(id){
        $('#'+id).toggle();
    }
</script>
</body>
</html>